home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: Mailbox/MIME Entity
(archive/mbox).
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| Newsgroup Content (archive/news)
| magic
| Supported |
100%
| dexvert
| Mailbox/MIME Entity (archive/mbox)
| magic
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| news text
| default
| |
99%
| file
| C++ source text
| default
| |
98%
| file
| C source text
| default
| |
97%
| file
| C source, ASCII text
| default
| |
100%
| checkBytes
| Printable ASCII
| default
| |
100%
| dexmagic
| PrintFox/Pagefox WEAK
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| siegfried
| fmt/950 MIME Email (1.0)
| default
| |
100%
| detectItEasy
| Format: plain text[LF]
| default (weak)
| |
100%
| xdgMime
| message/news
| default
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 50 61 74 68 3a 20 6e 65 | 77 73 66 65 65 64 2e 63 |Path: ne|wsfeed.c|
|00000010| 6f 6e 63 65 6e 74 72 69 | 63 2e 6e 65 74 21 6e 65 |oncentri|c.net!ne|
|00000020| 77 73 2d 6d 61 73 74 65 | 72 21 6e 65 77 73 0a 46 |ws-maste|r!news.F|
|00000030| 72 6f 6d 3a 20 52 6f 6e | 20 53 6d 69 74 68 20 3c |rom: Ron| Smith <|
|00000040| 72 6b 73 69 69 40 63 72 | 69 73 2e 63 6f 6d 3e 0a |rksii@cr|is.com>.|
|00000050| 4e 65 77 73 67 72 6f 75 | 70 73 3a 20 63 6f 6d 70 |Newsgrou|ps: comp|
|00000060| 2e 6c 61 6e 67 2e 63 2b | 2b 0a 53 75 62 6a 65 63 |.lang.c+|+.Subjec|
|00000070| 74 3a 20 52 65 3a 20 5c | 5c 20 71 75 65 73 74 69 |t: Re: \|\ questi|
|00000080| 6f 6e 20 66 6f 20 69 6f | 73 74 72 65 61 6d 20 70 |on fo io|stream p|
|00000090| 65 6f 70 6c 65 20 2f 2f | 0a 44 61 74 65 3a 20 4d |eople //|.Date: M|
|000000a0| 6f 6e 2c 20 32 35 20 4d | 61 72 20 31 39 39 36 20 |on, 25 M|ar 1996 |
|000000b0| 30 30 3a 31 31 3a 33 31 | 20 2d 30 36 30 30 0a 4f |00:11:31| -0600.O|
|000000c0| 72 67 61 6e 69 7a 61 74 | 69 6f 6e 3a 20 43 6f 6e |rganizat|ion: Con|
|000000d0| 63 65 6e 74 72 69 63 20 | 49 6e 74 65 72 6e 65 74 |centric |Internet|
|000000e0| 20 53 65 72 76 69 63 65 | 73 0a 4d 65 73 73 61 67 | Service|s.Messag|
|000000f0| 65 2d 49 44 3a 20 3c 33 | 31 35 36 33 39 31 33 2e |e-ID: <3|1563913.|
|00000100| 35 39 33 39 40 63 72 69 | 73 2e 63 6f 6d 3e 0a 52 |5939@cri|s.com>.R|
|00000110| 65 66 65 72 65 6e 63 65 | 73 3a 20 3c 34 69 73 74 |eference|s: <4ist|
|00000120| 75 6c 24 6a 6f 6e 40 74 | 68 61 6c 65 73 2e 6e 6d |ul$jon@t|hales.nm|
|00000130| 69 61 2e 63 6f 6d 3e 0a | 4e 4e 54 50 2d 50 6f 73 |ia.com>.|NNTP-Pos|
|00000140| 74 69 6e 67 2d 48 6f 73 | 74 3a 20 63 6e 63 38 30 |ting-Hos|t: cnc80|
|00000150| 31 31 33 33 2e 63 6f 6e | 63 65 6e 74 72 69 63 2e |1133.con|centric.|
|00000160| 6e 65 74 0a 4d 69 6d 65 | 2d 56 65 72 73 69 6f 6e |net.Mime|-Version|
|00000170| 3a 20 31 2e 30 0a 43 6f | 6e 74 65 6e 74 2d 54 79 |: 1.0.Co|ntent-Ty|
|00000180| 70 65 3a 20 74 65 78 74 | 2f 70 6c 61 69 6e 3b 20 |pe: text|/plain; |
|00000190| 63 68 61 72 73 65 74 3d | 75 73 2d 61 73 63 69 69 |charset=|us-ascii|
|000001a0| 0a 43 6f 6e 74 65 6e 74 | 2d 54 72 61 6e 73 66 65 |.Content|-Transfe|
|000001b0| 72 2d 45 6e 63 6f 64 69 | 6e 67 3a 20 37 62 69 74 |r-Encodi|ng: 7bit|
|000001c0| 0a 58 2d 4d 61 69 6c 65 | 72 3a 20 4d 6f 7a 69 6c |.X-Maile|r: Mozil|
|000001d0| 6c 61 20 32 2e 30 47 6f | 6c 64 42 31 20 28 57 69 |la 2.0Go|ldB1 (Wi|
|000001e0| 6e 39 35 3b 20 49 29 0a | 54 6f 3a 20 47 69 6c 62 |n95; I).|To: Gilb|
|000001f0| 65 72 74 20 48 65 61 6c | 74 6f 6e 20 3c 67 68 65 |ert Heal|ton <ghe|
|00000200| 61 6c 74 6f 6e 40 6e 6d | 69 61 2e 63 6f 6d 3e 0a |alton@nm|ia.com>.|
|00000210| 0a 47 69 6c 62 65 72 74 | 20 48 65 61 6c 74 6f 6e |.Gilbert| Healton|
|00000220| 20 77 72 6f 74 65 3a 0a | 3e 20 0a 3e 20 48 6f 77 | wrote:.|> .> How|
|00000230| 20 6d 61 6e 79 20 67 6f | 6f 64 20 77 61 79 73 20 | many go|od ways |
|00000240| 61 72 65 20 74 68 65 72 | 65 20 74 6f 20 73 6f 6c |are ther|e to sol|
|00000250| 76 65 20 74 68 69 73 20 | 70 72 6f 62 6c 65 6d 20 |ve this |problem |
|00000260| 28 49 20 61 6d 20 6c 6f | 6f 6b 69 6e 67 20 66 6f |(I am lo|oking fo|
|00000270| 72 20 6f 6e 65 29 3a 0a | 3e 20 0a 3e 20 20 20 20 |r one):.|> .> |
|00000280| 53 65 74 20 75 70 20 73 | 6f 6d 65 20 74 79 70 65 |Set up s|ome type|
|00000290| 20 6f 66 20 49 2f 4f 20 | 73 74 72 65 61 6d 20 28 | of I/O |stream (|
|000002a0| 6f 72 20 73 74 72 65 61 | 6d 20 72 65 66 65 72 65 |or strea|m refere|
|000002b0| 6e 63 65 20 61 6e 64 20 | 73 74 72 65 61 6d 29 20 |nce and |stream) |
|000002c0| 74 68 61 74 0a 3e 20 20 | 20 20 61 6c 6c 6f 77 73 |that.> | allows|
|000002d0| 20 61 20 70 72 6f 67 72 | 61 6d 20 74 6f 20 77 72 | a progr|am to wr|
|000002e0| 69 74 65 20 74 6f 20 65 | 69 74 68 65 72 20 73 74 |ite to e|ither st|
|000002f0| 61 6e 64 61 72 64 20 6f | 75 74 20 6f 72 20 61 20 |andard o|ut or a |
|00000300| 73 65 6c 65 63 74 65 64 | 20 66 69 6c 65 2e 0a 3e |selected| file..>|
|00000310| 20 20 20 20 54 68 65 20 | 61 62 69 6c 69 74 79 20 | The |ability |
|00000320| 74 6f 20 73 77 69 74 63 | 68 20 61 74 20 77 69 6c |to switc|h at wil|
|00000330| 6c 20 61 74 20 64 69 66 | 66 65 72 65 6e 74 20 70 |l at dif|ferent p|
|00000340| 6f 69 6e 74 73 20 6f 66 | 20 74 68 65 20 70 72 6f |oints of| the pro|
|00000350| 67 72 61 6d 20 69 73 0a | 3e 20 20 20 20 76 69 74 |gram is.|> vit|
|00000360| 61 6c 2e 20 43 6f 64 65 | 20 74 68 61 74 20 77 6f |al. Code| that wo|
|00000370| 72 6b 73 20 6f 6e 20 64 | 69 66 66 65 72 65 6e 74 |rks on d|ifferent|
|00000380| 20 63 6f 6d 70 69 6c 65 | 72 73 20 69 73 20 70 72 | compile|rs is pr|
|00000390| 65 66 65 72 72 65 64 2e | 0a 3e 20 2e 2e 2e 2e 2e |eferred.|.> .....|
|000003a0| 0a 0a 53 69 6e 63 65 20 | 74 68 69 73 20 69 73 20 |..Since |this is |
|000003b0| 43 2b 2b 2c 20 6c 65 74 | 27 73 20 65 6e 63 61 70 |C++, let|'s encap|
|000003c0| 73 75 6c 61 74 65 20 74 | 68 65 20 62 65 68 61 76 |sulate t|he behav|
|000003d0| 69 6f 72 2e 20 20 49 20 | 6a 75 73 74 20 6b 69 6e |ior. I |just kin|
|000003e0| 64 20 6f 66 20 74 68 72 | 65 77 20 74 68 69 73 20 |d of thr|ew this |
|000003f0| 74 6f 67 65 74 68 65 72 | 20 73 6f 2c 0a 70 6c 65 |together| so,.ple|
|00000400| 61 73 65 20 66 6f 72 67 | 69 76 65 20 61 6e 79 20 |ase forg|ive any |
|00000410| 74 79 70 6f 73 2e 20 20 | 54 68 65 72 65 20 69 73 |typos. |There is|
|00000420| 20 70 72 6f 62 61 62 6c | 79 20 61 20 6d 6f 72 65 | probabl|y a more|
|00000430| 20 65 6c 65 67 61 6e 74 | 20 77 61 79 20 6f 66 20 | elegant| way of |
|00000440| 70 72 6f 76 69 64 69 6e | 67 20 61 63 63 65 73 73 |providin|g access|
|00000450| 20 74 6f 20 74 68 65 0a | 73 74 72 65 61 6d 20 28 | to the.|stream (|
|00000460| 6d 61 79 62 65 20 69 6e | 68 65 72 69 74 69 6e 67 |maybe in|heriting|
|00000470| 20 66 72 6f 6d 20 6f 73 | 74 72 65 61 6d 20 6f 72 | from os|tream or|
|00000480| 20 73 6f 6d 65 74 68 69 | 6e 67 29 2e 20 20 49 6e | somethi|ng). In|
|00000490| 20 74 68 69 73 20 65 78 | 61 6d 70 6c 65 2c 20 74 | this ex|ample, t|
|000004a0| 68 65 20 73 74 72 65 61 | 6d 20 61 75 74 6f 6d 61 |he strea|m automa|
|000004b0| 67 69 63 61 6c 6c 79 0a | 63 6c 6f 73 65 73 20 77 |gically.|closes w|
|000004c0| 68 65 6e 20 6f 70 65 6e | 20 69 73 20 63 61 6c 6c |hen open| is call|
|000004d0| 65 64 20 6f 72 20 77 68 | 65 6e 20 74 68 65 20 63 |ed or wh|en the c|
|000004e0| 6c 61 73 73 20 69 73 20 | 64 65 73 74 72 6f 79 65 |lass is |destroye|
|000004f0| 64 2e 20 20 49 74 20 65 | 6c 69 6d 69 6e 61 74 65 |d. It e|liminate|
|00000500| 73 20 61 6c 6c 20 6f 66 | 20 74 68 65 20 63 6f 6e |s all of| the con|
|00000510| 64 69 74 69 6f 6e 61 6c | 0a 63 6f 64 65 20 69 6e |ditional|.code in|
|00000520| 20 74 68 65 20 69 66 28 | 29 0a 0a 2f 2f 20 53 77 | the if(|)..// Sw|
|00000530| 69 74 63 68 53 74 72 65 | 61 6d 20 45 78 61 6d 70 |itchStre|am Examp|
|00000540| 6c 65 0a 0a 23 69 6e 63 | 6c 75 64 65 20 3c 66 73 |le..#inc|lude <fs|
|00000550| 74 72 65 61 6d 2e 68 3e | 0a 0a 63 6c 61 73 73 20 |tream.h>|..class |
|00000560| 53 77 69 74 63 68 53 74 | 72 65 61 6d 20 7b 0a 70 |SwitchSt|ream {.p|
|00000570| 75 62 6c 69 63 3a 0a 20 | 20 20 53 77 69 74 63 68 |ublic:. | Switch|
|00000580| 53 74 72 65 61 6d 28 63 | 68 61 72 2a 20 66 6e 61 |Stream(c|har* fna|
|00000590| 6d 65 20 3d 20 4e 55 4c | 4c 2c 20 69 6e 74 20 6d |me = NUL|L, int m|
|000005a0| 6f 64 65 20 3d 20 69 6f | 73 3a 3a 6f 75 74 29 20 |ode = io|s::out) |
|000005b0| 3a 20 66 73 74 72 6d 28 | 4e 55 4c 4c 29 20 7b 20 |: fstrm(|NULL) { |
|000005c0| 6f 70 65 6e 28 66 6e 61 | 6d 65 2c 20 6d 6f 64 65 |open(fna|me, mode|
|000005d0| 29 3b 20 7d 0a 20 20 20 | 7e 53 77 69 74 63 68 53 |); }. |~SwitchS|
|000005e0| 74 72 65 61 6d 28 29 20 | 7b 20 63 6c 6f 73 65 28 |tream() |{ close(|
|000005f0| 29 3b 20 7d 0a 20 20 20 | 69 6e 74 20 6f 70 65 6e |); }. |int open|
|00000600| 28 63 68 61 72 2a 20 66 | 6e 61 6d 65 20 3d 20 4e |(char* f|name = N|
|00000610| 55 4c 4c 2c 20 69 6e 74 | 20 6d 6f 64 65 20 3d 20 |ULL, int| mode = |
|00000620| 69 6f 73 3a 3a 6f 75 74 | 29 3b 0a 20 20 20 76 6f |ios::out|);. vo|
|00000630| 69 64 20 63 6c 6f 73 65 | 28 29 20 7b 20 69 66 20 |id close|() { if |
|00000640| 28 66 73 74 72 6d 29 20 | 7b 20 64 65 6c 65 74 65 |(fstrm) |{ delete|
|00000650| 20 66 73 74 72 6d 3b 20 | 66 73 74 72 6d 20 3d 20 | fstrm; |fstrm = |
|00000660| 4e 55 4c 4c 3b 20 7d 7d | 0a 20 20 20 63 6f 6e 73 |NULL; }}|. cons|
|00000670| 74 20 6f 73 74 72 65 61 | 6d 26 20 73 74 72 65 61 |t ostrea|m& strea|
|00000680| 6d 28 29 20 63 6f 6e 73 | 74 20 7b 20 72 65 74 75 |m() cons|t { retu|
|00000690| 72 6e 20 28 66 73 74 72 | 6d 20 3f 20 2a 66 73 74 |rn (fstr|m ? *fst|
|000006a0| 72 6d 20 3a 20 63 6f 75 | 74 29 3b 20 7d 0a 0a 70 |rm : cou|t); }..p|
|000006b0| 72 69 76 61 74 65 3a 0a | 20 20 20 6f 66 73 74 72 |rivate:.| ofstr|
|000006c0| 65 61 6d 2a 20 66 73 74 | 72 6d 3b 0a 7d 3b 0a 0a |eam* fst|rm;.};..|
|000006d0| 69 6e 74 20 53 77 69 74 | 63 68 53 74 72 65 61 6d |int Swit|chStream|
|000006e0| 3a 3a 6f 70 65 6e 28 63 | 68 61 72 2a 20 66 6e 61 |::open(c|har* fna|
|000006f0| 6d 65 2c 20 69 6e 74 20 | 6d 6f 64 65 29 20 7b 0a |me, int |mode) {.|
|00000700| 20 20 20 63 6c 6f 73 65 | 28 29 3b 0a 20 20 20 69 | close|();. i|
|00000710| 66 20 28 66 6e 61 6d 65 | 29 0a 20 20 20 20 20 20 |f (fname|). |
|00000720| 66 73 74 72 6d 20 3d 20 | 6e 65 77 20 6f 66 73 74 |fstrm = |new ofst|
|00000730| 72 65 61 6d 28 66 6e 61 | 6d 65 2c 20 6d 6f 64 65 |ream(fna|me, mode|
|00000740| 29 3b 0a 7d 0a 0a 69 6e | 74 20 6d 61 69 6e 28 29 |);.}..in|t main()|
|00000750| 20 7b 0a 20 20 20 63 68 | 61 72 2a 20 73 74 72 6d | {. ch|ar* strm|
|00000760| 70 61 74 68 20 3d 20 4e | 55 4c 4c 3b 0a 20 20 20 |path = N|ULL;. |
|00000770| 53 77 69 74 63 68 53 74 | 72 65 61 6d 20 73 77 73 |SwitchSt|ream sws|
|00000780| 74 72 6d 28 29 3b 09 2f | 2f 20 77 68 69 63 68 2c |trm();./|/ which,|
|00000790| 20 62 79 20 64 65 66 61 | 75 6c 74 20 73 74 61 72 | by defa|ult star|
|000007a0| 74 73 20 6f 75 74 20 70 | 6f 69 6e 74 69 6e 67 20 |ts out p|ointing |
|000007b0| 74 6f 20 63 6f 75 74 0a | 0a 20 20 20 2f 2f 20 2e |to cout.|. // .|
|000007c0| 2e 2e 0a 0a 20 20 20 69 | 66 20 28 53 6f 6d 65 43 |.... i|f (SomeC|
|000007d0| 6f 6e 64 69 74 69 6f 6e | 29 0a 20 20 20 20 20 20 |ondition|). |
|000007e0| 73 77 73 74 72 6d 2e 6f | 70 65 6e 28 73 74 72 6d |swstrm.o|pen(strm|
|000007f0| 70 61 74 68 29 3b 0a 20 | 20 20 0a 20 20 20 73 77 |path);. | . sw|
|00000800| 73 74 72 6d 2e 73 74 72 | 65 61 6d 28 29 20 3c 3c |strm.str|eam() <<|
|00000810| 20 22 54 68 69 73 20 69 | 73 20 68 6f 77 20 79 6f | "This i|s how yo|
|00000820| 75 20 6d 69 67 68 74 20 | 75 73 65 20 74 68 65 20 |u might |use the |
|00000830| 73 74 72 65 61 6d 22 3b | 0a 7d 3b 0a |stream";|.};. |
+--------+-------------------------+-------------------------+--------+--------+